﻿//-----------------------------------------------------------------------
// <copyright file="IThreadedService.cs" company="FastNET Services">
//     Copyright (c) 2008-2009. All Rights Reserved.
// </copyright>
// <license>
//     GPLv2
// </license>
// <warranty>
//     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
//     BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
//     DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// </warranty>
//-----------------------------------------------------------------------
#region Usings

using System;
using GateShift.Services.SDK.Services.Events;

#endregion

namespace GateShift.Services.SDK.Services.Interfaces
{
    /// <summary>
    /// Extended Service Interface for services requiring a management thread
    /// </summary>
    public interface IThreadedService : IService
    {
        /// <summary>
        /// Event fired when the state has changed for the service
        /// </summary>
        event EventHandler<StateChangedEventArgs> StateChanged;

        /// <summary>
        /// Gets the current state for the service management thread
        /// </summary>
        ServiceState CurrentState { get; }

        /// <summary>
        /// Starts the service management thread
        /// </summary>
        /// <returns>Success of starting the management thread</returns>
        bool Start();

        /// <summary>
        /// Stops the service management thread
        /// </summary>
        /// <returns>Success of stopping the management thread</returns>
        bool Stop();
    }
}